#!/bin/bash

option=$1

DIR_MBEDTLS="mbedtls-2.16.9"
TAR_MBEDTLS="mbedtls-2.16.9.tar.gz"

if test ! -z $option ; then
	if test $option = "-c" ; then
        rm -rf $DIR_MBEDTLS
        exit 0
    fi
fi

if test ! -d $DIR_MBEDTLS ; then
    tar xvfz $TAR_MBEDTLS
fi

cd $DIR_MBEDTLS
cmake . -Bbuild -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Release
cd build
make -j32
make install
